import sys
sys.path.append("..")
from arff import *
from splitonefile import *
import unittest

class testSplitOneFile(unittest.TestCase):
    def testMergeEqualAll(self):
        """
        merge the split and got all file
        """
        num = 5
        splitonefile("./test.arff",num)
        arff = parserArffItems("./test.arff")
        mergeitems = []
        for i in range(num):
            tmparff = parserArffItems("./split/"+str(i)+"/test.arff")
            mergeitems.extend(tmparff['datas'])
        for i in range(len(arff['datas'])):
            self.assertEqual(arff['datas'][i],mergeitems[i])
        

if __name__ == "__main__":
    unittest.main()   
